Skip to main content

Session management framework

Introduction

What is hosting ?

The goal is to allow to have better control on the request IO layer

  • Simplify application server dockerization
  • Simplify inbound request management by using an host runtime library:
    • Security with SSO
    • Monitoring & event dispatching
    • Have better support on web protocols
    • Use third party libraries for devops purpose

The hosting separate the system in two parts:

  • App:
    • treat a request as high level programming object
    • open resource access for: events, service invokation, ...
  • Host:
    • receive bytestream form port, prepare & send it to App as programming object
    • manage resource access, protocol, and credentials

The App and Host communicate with data representation, the data are encapsulate into a object named document, the object provide memory management of data + adapted programming representation, see next section

Invalid document ID:data_representation_intro

What are future hosting possibilities ?

eWam could in future provide more programming API to the host:

  • Provide a an acces to ewam as ORM in the host language.
  • Provide access to business model in the host to create service in the host.
  • Provide host API for other platform, .netcore seems a good candidate.

Hosting Architecture

Session management is dedicated to manage the working context exposed to the web.

This architecture is based on the concept of hosting of ewam engine. The ewam engine expose two side:

  • session (aSystemSession): create and controled by the host, it's the request receiving point.
  • session context (aSystemSessionContext): is a motor context initiated with a router and services, which process the request.

Node Hosting example

Here is an example using express and nodejs

var Process = require("process")
const Path = require("path")
var express = require("express")
var cookieParser = require("cookie-parser")
require("ewam-kernel")
require("ewam-library");
var ewam = require("ewam-node-hosting")

const myArgs = []

const PORT = process.env.PORT || 9944
myArgs.push(`/RUNASSERVICE.PORT:${PORT}`)

// Add WFDLL
Process.env.PATH = `${Process.env.PATH};${__dirname}/node_modules/WFDLL/64`

const app = express()

app.use(cookieParser())

Process.env["WYDE-LICENSE"] = Path.join(__dirname, "Licence")
Process.env["WYDE-ADMIN"] = Path.join(__dirname, "Admin")
Process.env["WYDE-TGV"] = Path.join(__dirname, "TGV")

const administrator = ewam.connect(["@(wyde-admin)/required-parameters.cfg", "/RUNASSERVICE:(WYDE-ADMIN)/config-runtime.json", ...myArgs], () => { })
app.use("/admin", administrator.dispatchHttpRequest.bind(administrator))

const statelessConfig = administrator.getApplicationConfiguration("stateless")
app.use("/stateless", statelessConfig.dispatchHttpRequest.bind(statelessConfig))

const statefulConfig = administrator.getApplicationConfiguration("stateful")
app.use("/stateful", statefulConfig.dispatchHttpRequest.bind(statefulConfig))

const server = app.listen(PORT, function () {
const port = server.address().port
console.log("Process " + process.pid + " is listening on " + port)
})